package redis

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
	"house123/B/src/appconfig"
)

var (
	Client *redis.Client
)

func Redis() {
	appconf := appconfig.Conf.Redis
	Client = redis.NewClient(&redis.Options{
		Addr:     appconf.Addr,
		Password: appconf.Password,
		DB:       appconf.DB,
	})
	fmt.Println(Client)
	_, err := Client.Ping(context.Background()).Result()
	if err != nil {
		fmt.Println("redis连接失败")
	} else {
		fmt.Println("redis初始化成功")
	}
}
